/*
 *******************       播放控制       ******************
 
 */
#import <UIKit/UIKit.h>
#import <WXDLNASender/WXDLNASenderDevice.h>
#import <WXDLNASender/WXDLNASenderObjects.h>

@class WXDLNASenderRenderer;

// 响应解析回调协议
@protocol WXDLNASenderResponseDelegate <NSObject>

@optional

/// 播放内容更新
- (void)dlnaRenderer:(WXDLNASenderRenderer *)renderer onMediaChange:(WXDLNASenderMediaInfo *)mediaInfo;

/// 播放状态变更
- (void)dlnaRenderer:(WXDLNASenderRenderer *)renderer onStateChange:(WXDLNASenderRendererState)state;

/// 播放速度变更
- (void)dlnaRenderer:(WXDLNASenderRenderer *)renderer onPlaySpeedChange:(NSString *)speed;

/// 更新播放进度
- (void)dlnaRenderer:(WXDLNASenderRenderer *)renderer onPositionChange:(WXDLNASenderAVPositionInfo *)info;

/// 获取音频信息
- (void)dlnaRenderer:(WXDLNASenderRenderer *)renderer onVolumeResponse:(NSString *)volume;

/// 通信异常报错
- (void)dlnaRenderer:(WXDLNASenderRenderer *)renderer onError:(NSError *)error;

@end


@interface WXDLNASenderRenderer : NSObject

@property (nonatomic, strong, readonly) WXDLNASenderDevice *device;

@property (nonatomic, assign, readonly) WXDLNASenderRendererState renderState;

@property (nonatomic, strong) id<WXDLNASenderResponseDelegate>delegate;

/// 初始化
/// @param device 搜索得到的WXDLNASenderDevice
- (instancetype)initWithUPnPDevice:(WXDLNASenderDevice *)device;

/// 设置单个播放信息
/// 成功设置后会收到回调 -onMediaChange
/// 调用 play 来开启播放
/// @param mediaInfo 多媒体信息
- (void)setAVTransport:(WXDLNASenderMediaInfo *)mediaInfo;

/// 播放
- (void)play;

/// 暂停
- (void)pause;

/// 结束
- (void)stop;

/// 跳转进度
/// @param relTime 进度时间(单位秒)
- (void)seek:(float)relTime;

/// 设置音频值
/// @param value 值—>整数
- (void)setVolumeWith:(NSString *)value;

/****************    播放状态刷新    ****************/

/// 设置播放状态回调，播放进度回调, 会轮询接收端状态
/// @param interval 默认1s回调一次，如果不需要实时进度和状态回调设置为0
- (void)setRequestInterval:(float)interval;

/// 获取音量
- (void)getVolume;

/// 获取播放进度
- (void)getPositionInfo;

/// 获取播放状态
- (void)getTransportInfo;


/****************    配置播放列表    ****************/

/// 设置播放列表
/// @param mediaList 播放列表信息
- (void)setMediaList:(NSArray <WXDLNASenderMediaInfo *>*)mediaList;

/// 播放指定视频
/// @param uuid 视频标志符
- (void)playMediaInList:(NSString *)uuid;

/// 播放下一个
- (void)playNextInList;

/// 播放上一个
- (void)playPreviewInList;

@end
